package com.example.spring.controller;

import com.example.spring.service.ProductService;

/**
 * 产品控制器
 */
public class ProductController {
    private final ProductService productService;

    public ProductController(ProductService productService) {
        this.productService = productService;
    }

    public void create(String productName) {
        productService.createProduct(productName);
    }

    public void modify(String productName) {
        try {
            productService.modifyProduct(productName);
        } catch (Exception e) {
            System.out.println("捕获异常: " + e.getMessage());
        }
    }
}
